#!/bin/sh

DRV_BUILD_OUT=$1
shift 1
DRV_OUT=$1
shift 1
KERNEL=$1
shift 1
DRV_FILES=$*

DRV_FILE_EXT=".o"

echo $KERNEL | grep -q "^2.6."
if [ $? -eq 0 ]; then
	DRV_FILE_EXT=".ko"
fi

for f in $DRV_FILES; do
    if [ -f ${DRV_BUILD_OUT}/${f}$DRV_FILE_EXT ]; then
		mkdir -p $DRV_OUT
	    cp -p ${DRV_BUILD_OUT}/${f}$DRV_FILE_EXT $DRV_OUT
	else
		echo "could not find ${DRV_BUILD_OUT}/${f}$DRV_FILE_EXT"
	fi
done
